import numpy as np
import pandas as pd


def main():
    data = {'country': ['Belgium', 'India', 'Brazil'],
            'capital': ['brussels', 'new delhi', 'brasilia'],
            'population': [11190846, 1303171035, 207847528]}

    df1 = pd.DataFrame(data)
    '''
       country    capital  population
    0  Belgium   brussels    11190846
    1    India  new delhi  1303171035
    2   Brazil   brasilia   207847528
    '''
    print(df1)
    '''
    RangeIndex(start=0, stop=3, step=1)
    '''
    print(df1.index)
    '''
    Index(['country', 'capital', 'population'], dtype='object')
    '''
    print(df1.columns)
    '''
    [['Belgium' 'brussels' 11190846]
     ['India' 'new delhi' 1303171035]
     ['Brazil' 'brasilia' 207847528]]
    '''
    print(df1.values)

    # <class 'pandas.core.series.Series'>
    print(type(df1['country']))

    # <class 'generator'>
    print(type(df1.iterrows()))

    for row in df1.iterrows():
        '''
        (0, country        Belgium
        capital       brussels
        population    11190846
        Name: 0, dtype: object) <class 'tuple'>
        (1, country            India
        capital        new delhi
        population    1303171035
        Name: 1, dtype: object) <class 'tuple'>
        (2, country          Brazil
        capital        brasilia
        population    207847528
        Name: 2, dtype: object) <class 'tuple'>
        '''
        # print(row, type(row))

        '''
        country        Belgium
        capital       brussels
        population    11190846
        Name: 0, dtype: object <class 'pandas.core.series.Series'>
        country            India
        capital        new delhi
        population    1303171035
        Name: 1, dtype: object <class 'pandas.core.series.Series'>
        country          Brazil
        capital        brasilia
        population    207847528
        Name: 2, dtype: object <class 'pandas.core.series.Series'>
        '''
        # print(row[1], type(row[1]))


    s1 = pd.Series(data['country'])
    s2 = pd.Series(data['capital'])
    s3 = pd.Series(data['population'])

    '''
              0           1          2
    0   Belgium       India     Brazil
    1  brussels   new delhi   brasilia
    2  11190846  1303171035  207847528
    '''
    df2 = pd.DataFrame([s1, s2, s3])
    print(df2)

    df3 = pd.DataFrame([s1, s2, s3], index=['country', 'capital', 'population']).T
    print(df3)

if __name__ == '__main__':
    main()
